Skip to content

Fix signup username validation and CDM sidebar role gate#258

Open
dauglyon wants to merge 2 commits into
mainfrom
fix/signup-validation-and-cdm-gate
Open

Fix signup username validation and CDM sidebar role gate#258
dauglyon wants to merge 2 commits into
mainfrom
fix/signup-validation-and-cdm-gate

Conversation

@dauglyon
Copy link
Copy Markdown
Collaborator

Summary

Two small fixes to authenticated-user UX.

  • Signup username validation: Mirror the kbase/auth2 NewUserName rules on the signup form: must start with a lowercase letter, only [a-z0-9_], no repeating or trailing underscores, ≤100 chars. Previously the availability check lowercased the input before comparing to availablename, so e.g. John passed the frontend check and then got rejected by the backend. Special-character inputs (John.Doe, bad-user, …) reported "Username is not available — Suggested: X" which was actually a format problem, not a collision. Now the form shows a specific format error and the submit stays blocked until the input matches the backend rules.
  • CDM sidebar role gate: The CDM nav item was gated on CDM_JUPYTERHUB_ADMIN (admin only). Per the BERDL platform docs, BERDL_USER is the access role; CDM_JUPYTERHUB_ADMIN is a separate admin role for approving access requests. Switch the gate so users with BERDL_USER see the link.

Test plan

  • Signup with a username containing an uppercase letter (e.g. John) — submit stays blocked, format error shown.
  • Signup with bad-user, bad__user, baduser_, 1baduser — submit stays blocked with format error.
  • Signup with a valid lowercased username (e.g. testuser) — submit proceeds to step 3.
  • Username > 100 chars shows the "must be at most 100 characters" error.
  • Log in as a user with BERDL_USER but no admin role — CDM link visible in sidebar.
  • Log in as a user without BERDL_USER — CDM link not visible.
  • Unit tests: npm test -- --testPathPattern='src/features/signup/' (9 pass, including 6 new parameterized cases).

dauglyon added 2 commits May 29, 2026 15:32
The frontend availability check compared availablename to
username.toLowerCase(), so a username like "John" passed validation
but was then rejected by auth2 for the uppercase letter. Inputs with
characters auth2 strips (dots, hyphens, etc.) failed with a misleading
"Username is not available" message.

Mirror the kbase/auth2 NewUserName rules on the form: must start with
a lowercase letter, only [a-z0-9_], no repeating or trailing
underscores, at most 100 chars. Show a specific error for format
violations and only treat availability mismatches as collisions.
The CDM nav item was gated on CDM_JUPYTERHUB_ADMIN, so only admins
saw the link. Per the BERDL platform docs, BERDL_USER is the role
that gates access to the lakehouse; CDM_JUPYTERHUB_ADMIN is a
separate admin role for approving access requests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant